<template >
  <el-container style="height: 100%">
    <el-aside width="auto">
      <div class="sidebar">
        <el-menu
          class="el-menu-vertical-demo"
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#ffd04b"
          :collapse="isCollapse"
          :unique-opend="true"
        >
          <template v-for="(submenu,index) in system">
          <el-submenu :index="index">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>{{ submenu.menusName }}</span>
            </template>
            <template v-for="(submenuchild,index) in submenu.child">
              <el-menu-item
                :index="index"
                :key="submenuchild.filenames"
                @click="
                  drawbord(
                    submenuchild.modelinfo,
                    submenuchild.modelname,
                    submenuchild.specialty,
                    submenuchild.modeltype
                  )
                "
              >
                {{ submenuchild.modelname }}
              </el-menu-item>
            </template>
          </el-submenu>
          </template>
        </el-menu>
      </div>
    </el-aside>

    <el-container>
      <div class="img" @click="drawzoom()" style="">
        <img
          src="../../../assets/hide.jpg"
          alt=""
          srcset=""
          style="position: absolute; top: 50%; z-index: 100"
        />
      </div>
      <el-header style="height: auto; padding: 0">
        <el-button
          type="info"
          style="margin-left: 10px"
          icon="el-icon-back"
          v-show="isshow"
          @click="drawshow()"
        ></el-button>
        <el-button
          type="info"
          icon="el-icon-right"
          v-show="!isshow"
          @click="drawhide()"
        ></el-button>
        <el-button
          type="info"
          id="editbtn"
          v-show="!isshow"
          @click="complie()"
          >编辑</el-button
        >
        <el-button
          type="info"
          id="finishbtn"
          v-show="!isshow"
          @click="accomplish()"
          >完成</el-button
        >
        <!-- <el-button
          type="info"
          id="comparebtn"
          v-show="!isshow"
          @click="comparbtn()"
          >多井对比</el-button
        > -->
        <el-button type="info" id="savebtn" v-show="!isshow" @click="save()"
          >保存模板</el-button
        >
        <el-button type="info" id="delbtn" v-show="!isshow" @click="delet()"
          >删除模板</el-button
        >
        <el-button type="info" id="skinbtn" v-show="!isshow" @click="skin()"
          >换肤</el-button
        >
        <!-- <el-button
          type="info"
          id="saveuserbtn"
          v-show="!isshow"
          @click="saveuser()"
          >另存为用户模板</el-button
        > -->
      </el-header>
      <div class="content" style="">
        <el-row class="main">
          <el-col :span="20" class="mainLeft" style="width: 100%" id="graph">
          </el-col>
        </el-row>
      </div>
    </el-container>
  </el-container>
</template>



<script>
import elementResize from "element-resize-detector"; // 尺寸监听组件
import axios from "axios";
import api from "../../../../static/layui/vuepublic";

export default {
  data() {
    return {
      api_address: api.api_address,
      wellname: "",
      wellid: "",
      isCollapse: false,
      isshow: false,
      modelsname: "",
      specialty: "",
      types: "",
      info: [],
      /**定时器名称 */
      timeinterval: null,
      /**深度最大值 */
      depthdatas: "",
      /**时间最大值 */
      timedatas: "",
      /** */
      countdata: "",
      system: [],
      usertem: [],
    };
  },
  mounted() {
    layui.use(["form", "colorpicker", "layer", "table"], () => {
      var form = layui.form;
      var layer = layui.layer;
      var table = layui.table;
      window.graph.layer = layer;
      window.graph.form = form;
      window.SChart.tables = table;
    });
    window.graph.PortSet(api.api_address);
    this.getinfo();
    this.getshowlist();
  },
  methods: {
    /**导航事件 */
    drawbord(info, name, specialty, type) {
      $("#graph").empty();
      this.DrawData(info);
      this.modelsname = name;
      this.specialty = specialty;
      this.types = type;
      this.info = info;
      window.graph.ShowTemplate(info, "graph", this.wellname, 0, 0);

      clearInterval(this.timeinterval);
      this.timeinterval = setInterval(() => {
        if (window.SChart.iseditor == false) {
          this.refresh(this.info);
          window.graph.Realtime();
        }
      }, 10000);
    },
    /**绘制方法及数据的获取 */
    DrawData(info) {
      var realdata = [];
      //最大值
      var countdata;
      var authorization = api.getoken;
      window.graph.Setfilpover(authorization, this.wellid);
      //表头
      if (info.headlist.length > 0) {
        for (let i = 0; i < info.headlist.length; i++) {
          var max = {};
          for (let j = 0; j < info.headcurvey.length; j++) {
            if (info.headcurvey[j].sort == info.headlist[i].sort) {
              var mins =
                info.headcurvey[j].tableName +
                "," +
                info.headcurvey[j].parameter;
              max[
                info.headlist[0].templateName +
                  ":" +
                  info.headcurvey[j].curveName +
                  ":" +
                  info.headlist[i].sort
              ] = mins;
            }
          }
          let dbname =
            info.headlist[i].dbname == ""
              ? this.wellname
              : info.headlist[i].dbname;
          $.ajax({
            type: "post",
            url:
              this.api_address +
              "/gd/GDBM?modelinfo=" +
              JSON.stringify(max) +
              "&wellid=" +
              this.wellid +
              "&dbname=" +
              dbname, //数据接口
            contentType: "application/json;",
            headers: {
              Authorization: authorization,
            },
            success: function (res) {
              let redata = JSON.parse(res);
              if (redata.code == 200) {
                realdata.push(redata.data);
                window.graph.Showdata(
                  realdata,
                  info.headlist[i].sort,
                  info.headlist[i].templateName,
                  ""
                );
              }
            },
            error: function () {
              layer.msg("请求失败");
            },
          });
        }
      }

      //深度和时间
      if (info.depthlist.length > 0) {
        window.SChart.list.splice(0);
        window.SChart.timelist.splice(0);
        //深度和时间的数据
        window.SChart.timedata.splice(0);
        window.SChart.listdata.splice(0);
        for (let i = 0; i < info.depthlist.length; i++) {
          switch (info.depthlist[i].templateName) {
            case "DepthView":
              var min = {};
              var max = {};
              let wellname =
                info.depthlist[i].dbname == ""
                  ? this.wellname
                  : info.depthlist[i].dbname;
              for (let j = 0; j < info.depthcurvey.length; j++) {
                if (info.depthcurvey[j].template == "DepthView") {
                  if (info.depthcurvey[j].ident == info.depthlist[i].ident) {
                    var mins =
                      info.depthcurvey[j].tablename +
                      "," +
                      info.depthcurvey[j].parameter;
                    min[info.depthcurvey[j].name] = mins;
                  }
                }
              }

              //获取最大值
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(min) +
                  "&dbname=" +
                  wellname +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    countdata = redata.data;
                  }
                },
              });
              if (countdata.value != null) {
                let isbool = window.graph.ShowRock(
                  info,
                  info.depthlist[i].ident
                );
                //岩屑道
                if (isbool == true) {
                  let cutdata;
                  $.ajax({
                    type: "post",
                    url:
                      this.api_address +
                      "/gd/Gainimg?wellid=" +
                      this.wellid +
                      "&dbname=" +
                      wellname, //数据接口
                    contentType: "application/json;",
                    headers: {
                      Authorization: authorization,
                    },
                    success: function (res) {
                      let redata = JSON.parse(res);
                      if (redata.code == 200) {
                        cutdata = redata.data;
                        window.graph.RockImage(
                          cutdata.rock,
                          cutdata.img,
                          info.depthlist[i].ident
                        );
                      }
                    },
                  });
                }
                //岩性道
                let bool = window.graph.Showlithology(
                  info,
                  info.depthlist[i].ident
                );
                if (bool == true) {
                  let rockdata;
                  $.ajax({
                    type: "post",
                    url:
                      this.api_address +
                      "/gd/Rockimg?wellid=" +
                      this.wellid +
                      "&dbname=" +
                      wellname, //数据接口
                    contentType: "application/json;",
                    headers: {
                      Authorization: authorization,
                    },
                    success: function (res) {
                      let redata = JSON.parse(res);
                      if (redata.code == 200) {
                        rockdata = redata.data;
                        window.graph.lithimage(
                          rockdata.lith,
                          rockdata.img,
                          info.depthlist[i].ident
                        );
                      }
                    },
                  });
                }

                //岩性描述
                let booldesc = window.graph.Showdesc(
                  info,
                  info.depthlist[i].ident
                );
                if (booldesc == true) {
                  let descdata;
                  $.ajax({
                    type: "post",
                    url:
                      this.api_address +
                      "/gd/GetDescing?wellid=" +
                      this.wellid +
                      "&dbname=" +
                      wellname, //数据接口
                    contentType: "application/json;",
                    headers: {
                      Authorization: authorization,
                    },
                    success: function (res) {
                      let redata = JSON.parse(res);
                      if (redata.code == 200) {
                        descdata = redata.data;
                        window.graph.descing(descdata, info.depthlist[i].ident);
                      }
                    },
                  });
                }

                //荧光道
                let boolNat = window.graph.Showfluor(
                  info,
                  info.depthlist[i].ident
                );
                if (boolNat == true) {
                  let fluordata;
                  $.ajax({
                    type: "post",
                    url:
                      this.api_address +
                      "/gd/GetFluordata?wellid=" +
                      this.wellid +
                      "&dbname=" +
                      wellname, //数据接口
                    contentType: "application/json;",
                    headers: {
                      Authorization: authorization,
                    },
                    success: function (res) {
                      let redata = JSON.parse(res);
                      if (redata.code == 200) {
                        fluordata = redata.data;
                        window.graph.FluorRect(
                          fluordata,
                          info.depthlist[i].ident
                        );
                      }
                    },
                  });
                }
                // //荧光标识
                // let boolNats = window.graph.Showflourtag(
                //   info,
                //   info.depthlist[i].ident
                // );
                // if (boolNats == true) {
                //   let flourtagdata;
                //   $.ajax({
                //     type: "post",
                //     url:
                //       this.api_address +
                //       "/gd/GetFluordata?wellid=" +
                //       this.wellid +
                //       "&dbname=" +
                //       wellname, //数据接口
                //     contentType: "application/json;",
                //     headers: {
                //       Authorization: authorization,
                //     },
                //     success: function (res) {
                //       let redata = JSON.parse(res);
                //       if (redata.code == 200) {
                //         flourtagdata = redata.data;
                //         window.graph.FluoresRect(
                //           flourtagdata,
                //           info.depthlist[i].ident
                //         );
                //       }
                //     },
                //   });
                // }
                // //颜色道
                // let boolNats = window.graph.Showflourtag(
                //   info,
                //   info.depthlist[i].ident
                // );
                // if (boolNats == true) {
                //   let flourtagdata;
                //   $.ajax({
                //     type: "post",
                //     url:
                //       this.api_address +
                //       "/gd/GetFluordata?wellid=" +
                //       this.wellid +
                //       "&dbname=" +
                //       wellname, //数据接口
                //     contentType: "application/json;",
                //     headers: {
                //       Authorization: authorization,
                //     },
                //     success: function (res) {
                //       let redata = JSON.parse(res);
                //       if (redata.code == 200) {
                //         flourtagdata = redata.data;
                //         window.graph.FluoresRect(
                //           flourtagdata,
                //           info.depthlist[i].ident
                //         );
                //       }
                //     },
                //   });
                // }

                let date = window.graph.SetScopes(
                  info,
                  countdata.value,
                  info.depthlist[i].ident
                );
                for (let j = 0; j < info.depthcurvey.length; j++) {
                  if (info.depthcurvey[j].template == "DepthView") {
                    if (info.depthcurvey[j].ident == info.depthlist[i].ident) {
                      var mins =
                        info.depthcurvey[j].tablename +
                        "," +
                        info.depthcurvey[j].parameter +
                        "," +
                        info.depthlist[i].depthtype;
                      var mi = date.min;
                      var mx = date.max;
                      max[
                        info.depthlist[i].templateName +
                          ":" +
                          info.depthcurvey[j].name +
                          ":" +
                          info.depthlist[i].ident
                      ] = mins + "," + mx + "," + mi;
                    }
                  }
                }
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(max) +
                    "&dbname=" +
                    wellname +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  cache: false,
                  success: function (res) {
                    let redata = JSON.parse(res);
                    if (redata.code == 200) {
                      realdata.push(redata.data);
                      window.graph.Showdata(
                        realdata,
                        info.depthlist[i].ident,
                        "DepthView",
                        ""
                      );
                    }
                  },
                });
              }

              break;
            case "TimeView":
              var timin = {};
              var timax = {};
              let well =
                info.depthlist[i].dbname == ""
                  ? this.wellname
                  : info.depthlist[i].dbname;
              for (let j = 0; j < info.depthcurvey.length; j++) {
                if (info.depthcurvey[j].template == "TimeView") {
                  if (info.depthcurvey[j].ident == info.depthlist[i].ident) {
                    var mins =
                      info.depthcurvey[j].tablename +
                      "," +
                      info.depthcurvey[j].parameter;
                    timin[info.depthcurvey[j].name] = mins;
                  }
                }
              }
              //获取最大值
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(timin) +
                  "&dbname=" +
                  well +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    countdata = redata.data;
                  }
                },
              });
              if (countdata.value != null && countdata.value.value != "0") {
                let da = window.graph.SetScopestime(
                  info,
                  countdata.value,
                  info.depthlist[i].ident
                );
                for (let k = 0; k < info.depthcurvey.length; k++) {
                  if (info.depthcurvey[k].template == "TimeView") {
                    if (info.depthcurvey[k].ident == info.depthlist[i].ident) {
                      var mins =
                        info.depthcurvey[k].tablename +
                        "," +
                        info.depthcurvey[k].parameter +
                        "," +
                        info.depthlist[i].depthtype;
                      var mi = da.min;
                      var mx = da.max;
                      timax[
                        info.depthlist[i].templateName +
                          ":" +
                          info.depthcurvey[k].name +
                          ":" +
                          info.depthlist[i].ident
                      ] = mins + "," + mx + "," + mi;
                    }
                  }
                }
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(timax) +
                    "&dbname=" +
                    well +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: true,
                  success: function (res) {
                    let redata = JSON.parse(res);
                    if (redata.code == 200) {
                      realdata.push(redata.data);
                      window.graph.Showdata(
                        realdata,
                        info.depthlist[i].ident,
                        "TimeView",
                        ""
                      );
                    }
                  },
                });
              }
              break;
          }
        }
      }

      //测斜
      if (info.surveylist.length > 0) {
        for (let i = 0; i < info.surveylist.length; i++) {
          var max = {};
          for (let j = 0; j < info.surveycurvey.length; j++) {
            if (info.surveycurvey[j].sort == info.surveylist[i].sort) {
              var mins =
                info.surveycurvey[j].tableName +
                "," +
                info.surveycurvey[j].parameter;
              max[
                info.surveylist[i].templateName +
                  ":" +
                  info.surveycurvey[j].curveName +
                  ":" +
                  info.surveycurvey[j].sort
              ] = mins;
            }
          }
          let dbname =
            info.surveylist[i].dbname == ""
              ? this.wellname
              : info.surveylist[i].dbname;
          $.ajax({
            type: "POST",
            url:
              this.api_address +
              "/gd/GDBM?modelinfo=" +
              JSON.stringify(max) +
              "&wellid=" +
              this.wellid +
              "&dbname=" +
              dbname, //数据接口
            dataType: "json",
            contentType: "application/json;",
            headers: {
              Authorization: authorization,
            },
            success: function (res) {
              let redata = JSON.parse(res);
              if (redata.code == 200) {
                realdata.push(redata.data);
                window.graph.Showdata(
                  realdata,
                  info.surveylist[i].sort,
                  info.surveylist[i].templateName,
                  ""
                );
              }
            },
            error: function () {
              layer.msg("请求失败");
            },
          });
        }
      }

      //数据控件
      let dataparms = [];
      let dbnames = [];
      let datasearchparams = [];
      if (info.datalist.length > 0) {
        for (let i = 0; i < info.datalist.length; i++) {
          var params = {};
          var para = "";
          var keys = {};
          for (let j = 0; j < info.datacurvey.length; j++) {
            if (info.datalist[i].sort == info.datacurvey[j].sort) {
              keys =
                info.datacurvey[j].curveType +
                "," +
                info.datacurvey[j].keys +
                "," +
                "0," +
                "0";
              para += info.datacurvey[j].parameter + ",";
              params[
                info.datalist[i].templateName +
                  ":" +
                  info.datalist[i].sort +
                  ":" +
                  info.datacurvey[j].tableName
              ] = para;
            }
          }
          let dbname =
            info.datalist[i].dbname == ""
              ? this.wellname
              : info.datalist[i].dbname;
          dataparms.push(params);
          dbnames.push(dbname);
          datasearchparams.push(keys);
        }
        window.SChart.params = dataparms;
        window.SChart.dbname = dbnames;
        window.SChart.datasearchparams = datasearchparams;
      }

      //定向井工具面
      if (info.toollist.length > 0) {
        for (let i = 0; i < info.toollist.length; i++) {
          var max = {};
          for (let j = 0; j < info.toolcurvey.length; j++) {
            if (info.toolcurvey[j].sort == info.toollist[i].sort) {
              var mins =
                info.toolcurvey[j].tableName +
                "," +
                info.toolcurvey[j].parameter;
              max[
                info.toollist[0].templateName +
                  ":" +
                  info.toolcurvey[j].curveName +
                  ":" +
                  info.toollist[i].sort +
                  ":" +
                  info.toolcurvey[j].showstatus
              ] = mins;
            }
          }
          let dbname =
            info.toollist[i].dbname == ""
              ? this.wellname
              : info.toollist[i].dbname;
          $.ajax({
            type: "post",
            url:
              this.api_address +
              "/gd/GDBM?modelinfo=" +
              JSON.stringify(max) +
              "&wellid=" +
              this.wellid +
              "&dbname=" +
              dbname, //数据接口
            contentType: "application/json;",
            headers: {
              Authorization: authorization,
            },
            success: function (res) {
              let redata = JSON.parse(res);
              if (redata.code == 200) {
                realdata.push(redata.data);
                window.graph.Showdata(
                  realdata,
                  info.toollist[i].sort,
                  info.toollist[i].templateName,
                  ""
                );
              }
            },
            error: function () {
              layer.msg("请求失败");
            },
          });
        }
      }

      //echart控件
      if (info.echart.length > 0) {
        window.Linechart.linedax.splice(0);
        window.Linechart.lineday.splice(0);
        window.Columnarchart.columnardax.splice(0);
        window.Columnarchart.columnarday.splice(0);
        window.Crosswisechart.crossdax.splice(0);
        window.Crosswisechart.crossday.splice(0);
        window.Numchart.Curvedatalist.splice(0);
        for (let i = 0; i < info.echart.length; i++) {
          switch (info.echart[i].templateName) {
            case "lineview":
              let linemin = {};
              let linemax = {};
              let well =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let linetype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "lineview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    linetype = info.curvelist[j].type;
                    linemin[info.curvelist[j].name] = mins;
                  }
                }
              }
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(linemin) +
                  "&dbname=" +
                  well +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    countdata = redata.data;
                  }
                },
              });

              if (countdata.value != null && countdata.value.value != "0") {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  countdata.value.key,
                  "lineview",
                  JSON.parse(info.echart[i].smallwidth),
                  linetype
                );
                if (linetype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "lineview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        linemax[
                          "lineview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(linetype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "lineview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        linemax[
                          "lineview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(linetype);
                      }
                    }
                  }
                }
                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(linemax) +
                    "&dbname=" +
                    well +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (res) {
                    let redata = JSON.parse(res);
                    if (redata.code == 200) {
                      realdata.push(redata.data);
                      window.graph.Showdata(
                        realdata,
                        info.echart[i].ident,
                        "lineview",
                        linetype
                      );
                    }
                  },
                });
              }
              break;
            case "columnarview":
              let colummin = {};
              let colummax = {};
              let wells =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let columtype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "columnarview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    columtype = info.curvelist[j].type;
                    colummin[info.curvelist[j].name] = mins;
                  }
                }
              }
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(colummin) +
                  "&dbname=" +
                  wells +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    countdata = redata.data;
                  }
                },
              });

              if (countdata.value != null && countdata.value.value != "0") {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  countdata.value.key,
                  "columnarview",
                  JSON.parse(info.echart[i].smallwidth),
                  columtype
                );

                if (columtype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "columnarview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        colummax[
                          "columnarview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(columtype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "columnarview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        colummax[
                          "columnarview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(columtype);
                      }
                    }
                  }
                }
                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(colummax) +
                    "&dbname=" +
                    wells +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (res) {
                    let redata = JSON.parse(res);
                    if (redata.code == 200) {
                      realdata.push(redata.data);
                      window.graph.Showdata(
                        realdata,
                        info.echart[i].ident,
                        "columnarview",
                        columtype
                      );
                    }
                  },
                });
              }

              break;
            case "crosswiseview":
              let crossmin = {};
              let crossmax = {};
              let welles =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let crosstype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "crosswiseview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    crosstype = info.curvelist[j].type;
                    crossmin[info.curvelist[j].name] = mins;
                  }
                }
              }
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(crossmin) +
                  "&dbname=" +
                  welles +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    countdata = redata.data;
                  }
                },
              });

              if (countdata.value != null && countdata.value.value != "0") {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  countdata.value.key,
                  "crosswiseview",
                  JSON.parse(info.echart[i].smallheight, crosstype),
                  crosstype
                );

                if (crosstype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "crosswiseview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        crossmax[
                          "crosswiseview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(crosstype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "crosswiseview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        crossmax[
                          "crosswiseview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(crosstype);
                      }
                    }
                  }
                }
                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(crossmax) +
                    "&dbname=" +
                    welles +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (res) {
                    let redata = JSON.parse(res);
                    if (redata.code == 200) {
                      realdata.push(redata.data);
                      window.graph.Showdata(
                        realdata,
                        info.echart[i].ident,
                        "crosswiseview",
                        crosstype
                      );
                    }
                  },
                });
              }

              break;
            case "numericalview":
              let numlist = {};
              let dbname =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              for (let j = 0; j < info.numlist.length; j++) {
                if (info.numlist[j].temlplate == "numericalview") {
                  if (info.numlist[j].ident == info.echart[i].ident) {
                    var mi =
                      info.numlist[j].tablename +
                      "," +
                      info.numlist[j].parameter;
                    numlist[
                      "numericalview" +
                        ":" +
                        info.numlist[j].name +
                        ":" +
                        info.numlist[j].ident
                    ] = mi;
                  }
                }
              }
              let realdata = [];
              $.ajax({
                type: "post",
                url:
                  this.api_address +
                  "/gd/GDBM?modelinfo=" +
                  JSON.stringify(numlist) +
                  "&dbname=" +
                  dbname +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let redata = JSON.parse(res);
                  if (redata.code == 200) {
                    realdata.push(redata.data);
                    window.graph.Showdata(
                      realdata,
                      info.echart[i].ident,
                      "numericalview",
                      ""
                    );
                  }
                },
              });
              window.graph.Showdata(
                realdata,
                info.echart[i].ident,
                "numericalview",
                ""
              );

              break;
            default:
              break;
          }
        }
      }
    },

    /**刷新数据*/
    refresh(info) {
      // if (getokend != false) {
      let that = this;
      var authorization = api.getoken;
      window.graph.Setfilpover(authorization, this.wellid);
      //表头
      if (info.headlist.length > 0) {
        window.SChart.curveauthorization = "";
        for (let i = 0; i < info.headlist.length; i++) {
          let max = {};
          let realdata = [];
          for (let j = 0; j < info.headcurvey.length; j++) {
            if (info.headcurvey[j].sort == info.headlist[i].sort) {
              var mins =
                info.headcurvey[j].tableName +
                "," +
                info.headcurvey[j].parameter;
              max[
                info.headlist[0].templateName +
                  ":" +
                  info.headcurvey[j].curveName +
                  ":" +
                  info.headlist[i].sort
              ] = mins;
            }
          }
          let dbname =
            info.headlist[i].dbname == ""
              ? this.wellname
              : info.headlist[i].dbname;

          this.getdata(
            max,
            dbname,
            realdata,
            info.headlist[i].templateName,
            info.headlist[i].sort,
            authorization
          );
        }
      }

      //深度
      if (info.depthlist.length > 0) {
        for (let i = 0; i < info.depthlist.length; i++) {
          switch (info.depthlist[i].templateName) {
            case "DepthView":
              let wellname =
                info.depthlist[i].dbname == ""
                  ? this.wellname
                  : info.depthlist[i].dbname;
              let bool = window.graph.JudgeReal(info.depthlist[i].ident);
              if (bool == true) {
                let min = window.graph.Setfiled(info.depthlist[i].ident);

                axios
                  .get(this.api_address + "/gd/GDBMC", {
                    params: {
                      modelinfo: JSON.stringify(min),
                      dbname: wellname,
                      wellid: this.wellid,
                    },
                    headers: {
                      Authorization: authorization, //token换成从缓存获取
                    },
                  })
                  .then(function (ret) {
                    let reas = JSON.parse(ret.data);
                    if (reas.code == 200) {
                      that.depthdatas = reas.data;
                    }
                  });
                if (this.depthdatas != undefined) {
                  if (this.depthdatas.value != null) {
                    //岩屑道
                    let isbool = window.graph.ShowRock(
                      info,
                      info.depthlist[i].ident
                    );
                    if (isbool == true) {
                      let cutdata;
                      $.ajax({
                        type: "post",
                        url:
                          this.api_address +
                          "/gd/Gainimg?wellid=" +
                          this.wellid +
                          "&dbname=" +
                          wellname, //数据接口
                        contentType: "application/json;",
                        headers: {
                          Authorization: authorization,
                        },
                        async: true,
                        success: function (res) {
                          let resdata = JSON.parse(res);
                          if (resdata.code == 0) {
                            cutdata = resdata.data;
                            window.graph.Realtimerock(cutdata.rock, "rock");
                          }
                        },
                      });
                    }
                    //岩性道
                    let bool = window.graph.Showlithology(
                      info,
                      info.depthlist[i].ident
                    );
                    if (bool == true) {
                      let rockdata;
                      $.ajax({
                        type: "post",
                        url:
                          this.api_address +
                          "/gd/Rockimg?wellid=" +
                          this.wellid +
                          "&dbname=" +
                          wellname, //数据接口
                        contentType: "application/json;",
                        headers: {
                          Authorization: authorization,
                        },
                        async: true,
                        success: function (res) {
                          let reas = JSON.parse(res);
                          if (reas.code == 0) {
                            rockdata = reas.data;
                            window.graph.Realtimerock(rockdata.lith, "lith");
                          }
                        },
                      });
                    }

                    //岩性描述
                    let booldesc = window.graph.Showdesc(
                      info,
                      info.depthlist[i].ident
                    );
                    if (booldesc == true) {
                      let descdata;
                      $.ajax({
                        type: "post",
                        url:
                          this.api_address +
                          "/gd/GetDescing?wellid=" +
                          this.wellid +
                          "&dbname=" +
                          wellname, //数据接口
                        contentType: "application/json;",
                        headers: {
                          Authorization: authorization,
                        },
                        async: true,
                        success: function (res) {
                          let reds = JSON.parse(res);
                          if (reds.code == 0) {
                            descdata = reds.data;
                            window.graph.Realtimerock(descdata, "desc");
                          }
                        },
                      });
                    }
                    //荧光道
                    let boolNat = window.graph.Showfluor(
                      info,
                      info.depthlist[i].ident
                    );
                    if (boolNat == true) {
                      let fluordata;
                      $.ajax({
                        type: "post",
                        url:
                          this.api_address +
                          "/gd/GetFluordata?wellid=" +
                          this.wellid +
                          "&dbname=" +
                          wellname, //数据接口
                        contentType: "application/json;",
                        headers: {
                          Authorization: authorization,
                        },
                        async: true,
                        success: function (res) {
                          let resdata = JSON.parse(res);
                          if (resdata.code == 0) {
                            fluordata = resdata.data;
                            window.graph.FluorRect(
                              fluordata,
                              info.depthlist[i].ident
                            );
                          }
                        },
                      });
                    }

                    let max = window.graph.Setscopref(
                      info.depthlist[i].ident,
                      this.depthdatas.value
                    );
                    let depthdata = [];

                    this.getdata(
                      max,
                      wellname,
                      depthdata,
                      "DepthView",
                      info.depthlist[i].ident,
                      authorization
                    );
                  }
                }
              }
              break;
            case "TimeView":
              let well =
                info.depthlist[i].dbname == ""
                  ? this.wellname
                  : info.depthlist[i].dbname;
              let isbool = window.graph.TimeJudgeReal(info.depthlist[i].ident);
              if (isbool == true) {
                let timin = window.graph.TimeSetfiled(info.depthlist[i].ident);
                axios
                  .get(this.api_address + "/gd/GDBMC", {
                    params: {
                      modelinfo: JSON.stringify(timin),
                      dbname: well,
                      wellid: this.wellid,
                    },
                    headers: {
                      Authorization: authorization, //token换成从缓存获取
                    },
                  })
                  .then(function (ret) {
                    let reas = JSON.parse(ret.data);
                    if (reas.code == 200) {
                      that.timedatas = reas.data;
                    }
                  });
                if (this.timedatas != undefined) {
                  if (
                    this.timedatas.value != null &&
                    this.timedatas.value.value != 0
                  ) {
                    let timax = window.graph.Timesetscopref(
                      info.depthlist[i].ident,
                      this.timedatas.value
                    );

                    let timedata = [];

                    this.getdata(
                      timax,
                      well,
                      timedata,
                      "TimeView",
                      info.depthlist[i].ident,
                      authorization
                    );
                  }
                }
              }
              break;
          }
        }
      }

      //测斜
      if (info.surveylist.length > 0) {
        for (let i = 0; i < info.surveylist.length; i++) {
          let max = {};
          let realdata = [];
          for (let j = 0; j < info.surveycurvey.length; j++) {
            if (info.surveycurvey[j].sort == info.surveylist[i].sort) {
              var mins =
                info.surveycurvey[j].tableName +
                "," +
                info.surveycurvey[j].parameter;
              max[
                info.surveylist[i].templateName +
                  ":" +
                  info.surveycurvey[j].curveName +
                  ":" +
                  info.surveycurvey[j].sort
              ] = mins;
            }
          }
          let dbname =
            info.surveylist[i].dbname == ""
              ? this.wellname
              : info.surveylist[i].dbname;

          this.getdata(
            max,
            dbname,
            realdata,
            info.surveylist[i].templateName,
            info.surveylist[i].sort,
            authorization
          );
        }
      }

      //数据控件
      if (info.datalist.length > 0) {
        for (let i = 0; i < info.datalist.length; i++) {
          let params = {};
          let para = "";
          for (let j = 0; j < info.datacurvey.length; j++) {
            if (info.datalist[i].sort == info.datacurvey[j].sort) {
              para += info.datacurvey[j].parameter + ",";
              params[
                info.datalist[i].templateName +
                  ":" +
                  info.datalist[i].sort +
                  ":" +
                  info.datacurvey[j].tableName
              ] = para;
            }
          }
          let dbname =
            info.datalist[i].dbname == ""
              ? this.wellname
              : info.datalist[i].dbname;
        }
      }

      //定向井工具面
      if (info.toollist.length > 0) {
        for (let i = 0; i < info.toollist.length; i++) {
          let max = {};
          let realdata = [];
          for (let j = 0; j < info.toolcurvey.length; j++) {
            if (info.toolcurvey[j].sort == info.toollist[i].sort) {
              var mins =
                info.toolcurvey[j].tableName +
                "," +
                info.toolcurvey[j].parameter;
              max[
                info.toollist[0].templateName +
                  ":" +
                  info.toolcurvey[j].curveName +
                  ":" +
                  info.toollist[i].sort +
                  ":" +
                  info.toolcurvey[j].showstatus
              ] = mins;
            }
          }
          let dbname =
            info.toollist[i].dbname == ""
              ? this.wellname
              : info.toollist[i].dbname;

          this.getdata(
            max,
            dbname,
            realdata,
            info.toollist[i].templateName,
            info.toollist[i].sort,
            authorization
          );
        }
      }

      //echart控件
      if (info.echart.length > 0) {
        for (let i = 0; i < info.echart.length; i++) {
          switch (info.echart[i].templateName) {
            case "lineview":
              let linemin = {};
              let linemax = {};
              let linedbname =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let linetype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "lineview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    linetype = info.curvelist[j].type;
                    linemin[info.curvelist[j].name] = mins;
                  }
                }
              }

              axios
                .get(this.api_address + "/gd/GDBMC", {
                  params: {
                    modelinfo: JSON.stringify(linemin),
                    dbname: linedbname,
                    wellid: this.wellid,
                  },
                  headers: {
                    Authorization: authorization, //token换成从缓存获取
                  },
                })
                .then(function (ret) {
                  let reas = JSON.parse(ret.data);
                  if (reas.code == 200) {
                    that.countdata = reas.data;
                  }
                });
              if (
                that.countdata.value != null &&
                that.countdata.value.value != "0"
              ) {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  that.countdata.value.key,
                  "lineview",
                  JSON.parse(info.echart[i].smallwidth),
                  linetype
                );
                if (linetype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "lineview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        linemax[
                          "lineview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(linetype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "lineview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        linemax[
                          "lineview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(linetype);
                      }
                    }
                  }
                }

                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(linemax) +
                    "&dbname=" +
                    linedbname +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (datas) {
                    let res = JSON.parse(datas);
                    if (res.code == 200) {
                      realdata.push(res.data);
                      window.graph.refreshdata(
                        realdata,
                        info.echart[i].ident,
                        "lineview",
                        linetype
                      );
                    }
                  },
                });
                // this.getdata(linemax,linedbname,realdata,"lineview",info.echart[i].ident)
              }
              break;
            case "columnarview":
              let colummin = {};
              let colummax = {};
              let coldbname =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let columtype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "columnarview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    columtype = info.curvelist[j].type;
                    colummin[info.curvelist[j].name] = mins;
                  }
                }
              }
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(colummin) +
                  "&dbname=" +
                  coldbname +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (res) {
                  let resdata = JSON.parse(res);
                  if (resdata.code == 200) {
                    that.countdata = resdata.data;
                  }
                },
              });
              if (
                that.countdata.value != null &&
                that.countdata.value.value != "0"
              ) {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  that.countdata.value.key,
                  "columnarview",
                  JSON.parse(info.echart[i].smallwidth),
                  columtype
                );

                if (columtype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "columnarview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        colummax[
                          "columnarview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(columtype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "columnarview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        colummax[
                          "columnarview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(columtype);
                      }
                    }
                  }
                }
                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(colummax) +
                    "&dbname=" +
                    coldbname +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (resdata) {
                    let res = JSON.parse(resdata);
                    if (res.code == 200) {
                      realdata.push(res.data);
                      window.graph.refreshdata(
                        realdata,
                        info.echart[i].ident,
                        "columnarview",
                        columtype
                      );
                    }
                  },
                });
              }

              break;
            case "crosswiseview":
              let crossmin = {};
              let crossmax = {};
              let crodbname =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              let crosstype;
              for (let j = 0; j < info.curvelist.length; j++) {
                if (info.curvelist[j].temlplate == "crosswiseview") {
                  if (info.curvelist[j].ident == info.echart[i].ident) {
                    var mins =
                      info.curvelist[j].tablename +
                      "," +
                      info.curvelist[j].parameter;
                    crosstype = info.curvelist[j].type;
                    crossmin[info.curvelist[j].name] = mins;
                  }
                }
              }
              $.ajax({
                type: "get",
                url:
                  this.api_address +
                  "/gd/GDBMC?modelinfo=" +
                  JSON.stringify(crossmin) +
                  "&dbname=" +
                  crodbname +
                  "&wellid=" +
                  this.wellid, //数据接口
                contentType: "application/json;",
                headers: {
                  Authorization: authorization,
                },
                async: false,
                success: function (resdata) {
                  let res = JSON.parse(resdata);
                  if (res.code == 200) {
                    that.countdata = res.data;
                  }
                },
              });
              if (
                that.countdata.value != null &&
                that.countdata.value.value != "0"
              ) {
                let da = window.graph.SetScopeEchart(
                  info.echart[i].ident,
                  that.countdata.value.key,
                  "crosswiseview",
                  JSON.parse(info.echart[i].smallheight, crosstype),
                  crosstype
                );

                if (crosstype == 2) {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "crosswiseview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        crossmax[
                          "crosswiseview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          "" +
                          "," +
                          JSON.parse(crosstype);
                      }
                    }
                  }
                } else {
                  for (let j = 0; j < info.curvelist.length; j++) {
                    if (info.curvelist[j].temlplate == "crosswiseview") {
                      if (info.curvelist[j].ident == info.echart[i].ident) {
                        var mins =
                          info.curvelist[j].tablename +
                          "," +
                          info.curvelist[j].parameter;
                        var mi = da.min;
                        var mx = da.max;
                        crossmax[
                          "crosswiseview" +
                            ":" +
                            info.curvelist[j].name +
                            ":" +
                            info.curvelist[j].ident
                        ] =
                          mins +
                          "," +
                          mx +
                          "," +
                          mi +
                          "," +
                          JSON.parse(crosstype);
                      }
                    }
                  }
                }
                let realdata = [];
                $.ajax({
                  type: "post",
                  url:
                    this.api_address +
                    "/gd/GDBM?modelinfo=" +
                    JSON.stringify(crossmax) +
                    "&dbname=" +
                    crodbname +
                    "&wellid=" +
                    this.wellid, //数据接口
                  contentType: "application/json;",
                  headers: {
                    Authorization: authorization,
                  },
                  async: false,
                  success: function (resdata) {
                    let res = JSON.parse(resdata);
                    if (res.code == 200) {
                      realdata.push(res.data);
                      window.graph.refreshdata(
                        realdata,
                        info.echart[i].ident,
                        "crosswiseview",
                        crosstype
                      );
                    }
                  },
                });
              }

              break;
            case "numericalview":
              let numlist = {};
              let numdbname =
                info.echart[i].dbname == ""
                  ? this.wellname
                  : info.echart[i].dbname;
              for (let j = 0; j < info.numlist.length; j++) {
                if (info.numlist[j].temlplate == "numericalview") {
                  if (info.numlist[j].ident == info.echart[i].ident) {
                    var mi =
                      info.numlist[j].tablename +
                      "," +
                      info.numlist[j].parameter;
                    numlist[
                      "numericalview" +
                        ":" +
                        info.numlist[j].name +
                        ":" +
                        info.numlist[j].ident
                    ] = mi;
                  }
                }
              }
              let realdata = [];

              this.getdata(
                numlist,
                numdbname,
                realdata,
                "numericalview",
                info.echart[i].ident,
                authorization
              );
              break;
            default:
              break;
          }
        }
      }
      // }
    },
    /**左侧菜单数据 */
    async getshowlist() {
      try {
        let params = {
          UserId: JSON.parse(this.$store.state.userInfo).uid,
          WellId: this.wellid,
          Specialty: "录井",
        };
        let res = await this.$api.set.getshowlist(params);
        // this.system = res.data[0].child;
        // this.usertem = res.data[1].child;
        this.system = res.data;
      } catch (error) {
        console.log(error);
      }
    },
    getinfo() {
      var param = this.$route.query;
      this.wellid = param.wellid;
      this.wellname = param.wellname;
      window.SChart.wellId = this.wellid; //获取井id
      window.SChart.specialty = "录井"; //获取专业名
    },
    drawzoom() {
      if (this.isCollapse == false) {
        this.isCollapse = true;
      } else {
        this.isCollapse = false;
      }
    },
    drawshow() {
      this.isshow = false;
    },
    drawhide() {
      this.isshow = true;
    },
    /**数据接口 */
    async getdata(max, wellname, depthdata, types, ids, token) {
      try {
        await axios
          .post(
            this.api_address +
              "/gd/GDBM?modelinfo=" +
              JSON.stringify(max) +
              "&dbname=" +
              wellname +
              "&wellid=" +
              this.wellid,
            {},
            {
              headers: {
                "content-type": "application/json",
                Authorization: api.getoken, //token换成从缓存获取
              },
            }
          )
          .then(function (ret) {
            let redata = JSON.parse(ret.data);
            if (redata.code == 200) {
              depthdata.push(redata.data);
              window.graph.refreshdata(depthdata, ids, types, "");
            }
          });
      } catch (error) {}
    },
    /**编辑 */
    complie() {
      window.graph.compile();
    },
    /**完成 */
    accomplish() {
      window.graph.accomplish();
    },
    /**多井对比 */
    comparbtn() {
      layer.open({
        type: 2,
        title: "多井对比井库选择",
        content: "./static/popups/library.html",
        area: ["350px", "350px"],
        btn: ["确认", "关闭"],
        yes: function (index) {
          var dbname = window["layui-layer-iframe" + index].retname(); //井库名
          if (dbname == "" || dbname == undefined) {
            layer.msg("请选择井库名!", { icon: 0 });
            return false;
          }
          window.graph.comparewell(dbname);
          layer.close(index);
        },
      });
    },
    /**保存 */
    save() {
      let list = {
        ModelName: this.modelsname,
        WellId: this.wellid,
        UserId: JSON.parse(this.$store.state.userInfo).uid,
        Specialty: this.specialty,
        ModelType: this.types,
        Image: "SideView.gif",
      };
      var res = JSON.parse(window.graph.SaveTemplate("/dl/saves", "", list));
      if (res.code == 200) {
        layer.msg("模板保存成功!", { icon: 1 });
        setTimeout(function () {
          window.location.reload(); //修改成功后刷新界面
        }, 1000);
      } else if (res == false) {
        layer.msg("请选择模板!", { icon: 2 });
      } else {
        layer.msg(res.msg);
      }
    },
    /**删除 */
    delet() {
      let list = {
        ModelName: this.modelsname,
        UserId: JSON.parse(this.$store.state.userInfo).uid,
        WellId: this.wellid,
        Specialty: this.specialty,
        ModelType: this.types,
      };
      layer.confirm(
        "确定要删除[" + this.modelsname + "]模板吗？",
        function (index) {
          var res = JSON.parse(
            window.graph.DeleteTemplate("/dl/deletes", "", list)
          );
          if (res.code == 200) {
            layer.msg("模板删除成功!", { icon: 1 });
            setTimeout(function () {
              window.location.reload(); //修改成功后刷新界面
            }, 1000);
          } else if (res == false) {
            layer.msg("请选择模板!", { icon: 2 });
          } else {
            layer.msg(res.msg);
          }
        }
      );
    },
    /**换肤 */
    skin() {
      layer.open({
        type: 2,
        title: "统一换肤",
        content: "./static/popups/Depth/Curveups.html",
        area: ["350px", "350px"],
        btn: ["确认"],
        yes: function (index) {
          var res = window["layui-layer-iframe" + index].Cureups();
          window.graph.WholeSkin(res);
          layer.close(index);
        },
      });
    },
    /**另存为用户模板 */
    saveuser() {
      var newname = $("#modelname").val();
      if (newname == "") {
        layer.msg("请输入模板名称!", { icon: 2 });
        return false;
      }
      let list = {
        ModelName: this.modelsname,
        WellId: this.wellid,
        UserId: JSON.parse(this.$store.state.userInfo).uid,
        Specialty: this.specialty,
        ModelType: this.types,
        Image: "SideView.gif",
      };
      var res = JSON.parse(
        window.graph.SaveTemplate("/dl/adds", AuthorizationM, list)
      );
      if (res.code == 200) {
        layer.msg("模板添加成功!", { icon: 1 });
        setTimeout(function () {
          window.location.reload(); //修改成功后刷新界面
        }, 1000);
      } else if (res == false) {
        layer.msg("请选择模板!", { icon: 2 });
      } else {
        layer.msg(res.msg);
      }
    },
  },
};
</script>
<style lang="less" scoped>
.sidebar {
  display: block;
  position: relative;
  left: 0;
  top: 0;
  bottom: 0;
  height: 100%;
  overflow-y: scroll;
}
.sidebar::-webkit-scrollbar {
  width: 0;
}
.sidebar > ul {
  height: 100%;
}
.el-menu {
  border-right-width: 0;
}
.el-menu h3 {
  text-align: center;
  line-height: 48px;
}
.el-menu-vertical-demo:not(.el-menu--collapse) {
  /*在官网的NaMenu -> 折叠 的样式的参考*/
  width: 200px;
  min-height: 400px;
}

.content .main {
  height: 895px;
  display: flex;
  justify-content: space-between;
}

.content .mainLeft {
  position: relative;
}

.img {
  cursor: pointer;
  width: 0.5em;
  position: absolute;
  left: 1;
  display: block;
  z-index: 90000000;
  height: 100%;
  background-color: #c3c2c2;
}
</style>